package com.zhentao.controller;

import com.github.pagehelper.PageInfo;
import com.zhentao.common.Result;
import com.zhentao.domain.dto.PageDto;
import com.zhentao.domain.vo.PowerCabinetVo;
import com.zhentao.service.SysPowerCabinetService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/powerCabinetVo")
@Tag(name = "站点电柜管理")
public class PowerCabinetVoController {
    @Autowired
    private SysPowerCabinetService sysPowerCabinetService;
    //换电柜站点电柜管理（增删改查）
//查询
    @PostMapping("/getPowerCabinetList")
    @Operation(summary = "查询站点电柜列表")
    public Result getPowerCabinetList(PageDto pageDto){
        PageInfo<PowerCabinetVo> powerCabinetList = sysPowerCabinetService.getPowerCabinetList(pageDto);
        return Result.build(powerCabinetList,200,"success");
    }
    @PostMapping("/getPowerCabinetsave")
    @Operation(summary = "添加站点电柜")
    public Result savePowerCabinet(@RequestBody PowerCabinetVo powerCabinetVo){
        sysPowerCabinetService.getPowerCabinetsave(powerCabinetVo);
        return Result.build(null,200,"success");
    }
    @PostMapping("/getPowerCabinetupdate")
    @Operation(summary = "修改站点电柜")
    public Result updatePowerCabinet(@RequestBody PowerCabinetVo powerCabinetVo){
        sysPowerCabinetService.getPowerCabinetupdate(powerCabinetVo);
        return Result.build(null,200,"success");
    }
    @DeleteMapping("/getPowerCabinetDelete")
    @Operation(summary = "删除站点电柜")
    public Result deletePowerCabinet(Integer id){
        sysPowerCabinetService.getPowerCabinetdelete(id);
        return Result.build(null,200,"success");
    }
}
